let href = location.href;//截取URL地址区分是否带项目路径
let cutTag = '/jeeadmin';

export function setBaseUrl(state) {
  let apiUrl = '';
  if (process.env.NODE_ENV == 'production') {
    let localHref = href.substring(0, href.indexOf(cutTag));
    apiUrl = process.env.baseUrl == '' ? localHref : process.env.baseUrl;//判断是否分离部署
  } else {
    let localHref = href.substring(0, href.indexOf(cutTag));
    apiUrl = process.env.baseUrl == '' ? localHref : process.env.baseUrl;//判断是否分离部署
  }
  return apiUrl;
};

export function getFilePathBaseUrl() {
  let filePathBaseUrl = process.env.filePathBaseUrl;
  if (process.env.NODE_ENV == 'production') {
    let localHref = href.substring(0, href.indexOf(cutTag));
    filePathBaseUrl = process.env.filePathBaseUrl == '' ? localHref : process.env.filePathBaseUrl;
  } else {
    let localHref = href.substring(0, href.indexOf(cutTag));
    filePathBaseUrl = process.env.filePathBaseUrl == '' ? localHref : process.env.filePathBaseUrl;
  }
  return filePathBaseUrl;
};

export function getPcUrl() {
  let pcUrl = process.env.pcUrl;
  if (process.env.NODE_ENV == 'production') {
    let localHref = href.substring(0, href.indexOf(cutTag));
    pcUrl = process.env.pcUrl == '' ? localHref : process.env.pcUrl;
  } else {
    let localHref = href.substring(0, href.indexOf(cutTag));
    pcUrl = process.env.pcUrl == '' ? localHref : process.env.pcUrl;
  }
  return pcUrl;
}
